import { init } from 'snabbdom/init';
import { classModule } from 'snabbdom/modules/class';
import { propsModule } from 'snabbdom/modules/props';
import { styleModule } from 'snabbdom/modules/style';
import { eventListenersModule } from 'snabbdom/modules/eventlisteners';
import { h } from 'snabbdom/h'; // helper function for creating vnodes

const patch = init([ classModule, propsModule, styleModule, eventListenersModule ]);


const container = document.getElementById('container')
const btn = document.getElementById('btn')


const node1 = h('h1', {}, 'Beep,Beep,MotHerfucker')
const node2 = h('section', {}, [
  h('h3', {}, 'Beep,beep,motHerFUcker'),
  h('h3', {}, 'Beep,beep,motHerFUcker'),
  h('h3', {}, [
    h('i', {}, 'I am Italian')
  ])
])

patch(container, node2);
// console.log(node2)

btn.addEventListener('click', ()=>{ patch(node2, node1) })
